package com.company.cloud.page.modules.api.response;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.company.cloud.page.modules.api.models.PageComponentModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class PageComponentPageResponse {
    @ApiModelProperty(value = "页面组件列表")
    private List<PageComponentModel> records;

    @ApiModelProperty(value = "总数")
    private long total = 0;

    @ApiModelProperty(value = "当前分页总页数")
    private long pages;

    @ApiModelProperty(value = "每页显示条数，默认")
    private long size = 10;

    @ApiModelProperty(value = "当前页")
    private long current = 1;


    public PageComponentPageResponse(IPage<PageComponentModel> data) {
        this.setRecords(data.getRecords());
        this.setTotal(data.getTotal());
        this.setPages(data.getPages());
        this.setSize(data.getSize());
        this.setCurrent(data.getCurrent());
    }
}
